package com.kaiyiweitong.tongxing.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.kaiyiweitong.tongxing.R;
import com.kaiyiweitong.tongxing.activity.MainActivity;
import com.kaiyiweitong.tongxing.activity.my.AfterSellActivity;
import com.kaiyiweitong.tongxing.activity.my.CollectionCenterActivity;
import com.kaiyiweitong.tongxing.activity.my.ExchangeCouponActivity;
import com.kaiyiweitong.tongxing.activity.my.HelpCenterActivity;
import com.kaiyiweitong.tongxing.activity.my.IntegralShopActivity;
import com.kaiyiweitong.tongxing.activity.my.MyCouponActivity;
import com.kaiyiweitong.tongxing.activity.my.MyInviteCodeActivity;
import com.kaiyiweitong.tongxing.activity.my.MyMoneyActivity;
import com.kaiyiweitong.tongxing.activity.my.MyOrderActivity;
import com.kaiyiweitong.tongxing.activity.my.MyShareActivity;
import com.kaiyiweitong.tongxing.activity.my.PersonInfoActivity;
import com.kaiyiweitong.tongxing.activity.my.SettingActivity;
import com.kaiyiweitong.tongxing.activity.my.VipRightActivity;
import com.kaiyiweitong.tongxing.activity.my.CertificationActivity;
import com.kaiyiweitong.tongxing.widget.HorizontalProgressBarWithNumber;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;


/**
 * Created by Administrator on 2017/12/15 0015.
 */

public class MyFragment extends Fragment {
    @Bind(R.id.pic)
    ImageView mPic;
    @Bind(R.id.name)
    TextView mName;
    @Bind(R.id.vip_grade)
    TextView mVipGrade;
    @Bind(R.id.info_finish_progress)
    HorizontalProgressBarWithNumber mInfoFinishProgress;
    @Bind(R.id.progress_tv)
    TextView mProgressTv;
    private View mView;
    private MainActivity mActivity;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mView = inflater.inflate(R.layout.fragment_my, null);
        mActivity = (MainActivity) getActivity();
        ButterKnife.bind(this, mView);
        return mView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @OnClick({R.id.ll_exchange_coupon, R.id.setting_iv, R.id.certification, R.id.name, R.id.rl_collection, R.id.rl_share, R.id.rl_money, R.id.rl_coupon, R.id.ll_my_paper, R.id.ll_after_sell, R.id.ll_integral_shop, R.id.ll_vip_right, R.id.ll_invite_code, R.id.ll_help_center})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.setting_iv:
                go2Page(SettingActivity.class);
                break;
            case R.id.name:
                go2Page(PersonInfoActivity.class);
                break;
            case R.id.rl_collection:
                go2Page(CollectionCenterActivity.class);
                break;
            case R.id.rl_share:
                go2Page(MyShareActivity.class);
                break;
            case R.id.rl_money:
                go2Page(MyMoneyActivity.class);
                break;
            case R.id.rl_coupon:
                go2Page(MyCouponActivity.class);
                break;
            case R.id.ll_my_paper:
                go2Page(MyOrderActivity.class);
                break;
            case R.id.ll_after_sell:
                go2Page(AfterSellActivity.class);
                break;
            case R.id.ll_integral_shop:
                go2Page(IntegralShopActivity.class);
                break;
            case R.id.ll_vip_right:
                go2Page(VipRightActivity.class);
                break;
            case R.id.ll_invite_code:
                go2Page(MyInviteCodeActivity.class);
                break;
            case R.id.ll_help_center:
                go2Page(HelpCenterActivity.class);
                break;
            case R.id.certification:
                go2Page(CertificationActivity.class);
                break;
            case R.id.ll_exchange_coupon:
                go2Page(ExchangeCouponActivity.class);
                break;
        }
    }

    private void go2Page(Class clazz) {
        Intent intent = new Intent(mActivity, clazz);
        startActivity(intent);
    }
}
